package org.itboys.core.dto.order;

import lombok.Data;
import org.itboys.commons.utils.time.TimeUtils;
import org.itboys.core.dto.common.BaseDto;
import org.itboys.core.dto.count.SundayCountSceneDto;
import org.itboys.core.entity.mysql.SundayOrderScene;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 作者：zzq
 * 时间：2018/10/25
 * 描述：订单
 */
@Data
public class SundayOrderDto extends BaseDto {
    private Long ownerId;//购买人/原有人id
    private String ownerName;//购买人
    private Long memberId;//用户Id
    private Long userId;//江南布衣用户id
    private BigDecimal totalAmount;//订单金额应付
    private BigDecimal payAmount;//订单金额实付
    private String orderNo;//订单编号
    private Integer cartType;//购物车类型 1，购物车，2，立即购买 3，赠送
    private String description;//描述
    private Integer payType;//付款方式,1支付宝，2微信，3余额支付
    private String payNo;//付款流水号
    private Integer orderStatus;//订单状态

    //收货人信息
    private String receiveName;//收货人
    private String receiveMobile;//收货电话
    private Long provinceId;//省ID
    private String provinceName;//省名称
    private Long cityId;//市Id
    private String cityName;//市名称
    private Long districtId;//区ID
    private String districtName;//区名称
    private String receiveAddress;//收货地址
    //订单备注
    private String remark;//订单备注
    private Integer isCreateOrder;//是否创建了江南布衣订单
    private String createOrderMsg;//创建订单的返回结果消息
    //运费
    private BigDecimal sendAmount;//配送费
    private String sendCompany;//快递公司名称
    private String sendCode;//快递单号
    //时间信息
    private Date payTime;//付款时间
    private Date sendTime;//发货时间
    private Date receiveTime;//收货时间

    private List<SundayOrderScene> scenes;

    public String getPayTypeStr() {
        String payTypeStr = "";
        if (payType == null) {
            return payTypeStr;
        }
        switch (payType) {
            case 1:
                payTypeStr = "支付宝支付";
                break;
            case 3:
                payTypeStr = "微信支付";
                break;

            default:
                break;
        }
        return payTypeStr;
    }

    public String getReceiveTimeStr() {
        String str = "";
        if (receiveTime != null) {
            str = TimeUtils.format(receiveTime, "yyyy/MM/dd HH:mm;ss");
        }
        return str;
    }

    public String getPayTimeStr() {
        String str = "";
        if (payTime != null) {
            str = TimeUtils.format(payTime, "yyyy/MM/dd HH:mm:ss");
        }
        return str;
    }

    public String getSendTimeStr() {
        String str = "";
        if (sendTime != null) {
            str = TimeUtils.format(sendTime, "yyyy/MM/dd HH:mm:ss");
        }
        return str;
    }

    public String  getOrderStatusStr(){
        String orderStatusStr= "";
        if(orderStatus==null)return orderStatusStr;

        switch (orderStatus) {
            case 1:
                orderStatusStr="待支付";
                break;
            case 2:
                orderStatusStr="待发货";
                break;
            case 3:
                orderStatusStr="已发货";
                break;
            case 4:
                orderStatusStr="已收货";
                break;
            case 5:
                orderStatusStr="退款中";
                break;
            case 6:
                orderStatusStr="已退款";
                break;
            case 10:
                orderStatusStr="已取消";
                break;
            case 11:
                orderStatusStr="已送出";
                break;
            case 12:
                orderStatusStr="已领取";
                break;
            default:
                break;
        }
        return orderStatusStr;
    }


}
